home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / System7 tools / Frontier / Frontier SDK 2.1 / Toolkits / IAC Tools / iaclist.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-09  |  1.7 KB  |  93 lines  |  [TEXT/KAHL]

  1.  
  2. /*© Copyright 1988-1993 UserLand Software, Inc.  All Rights Reserved.*/
  3.  
  4. #include "iacinternal.h"
  5. #include "iacextras.h"
  6.  
  7.  
  8. Boolean IACpushlistparam (AEDescList * val, OSType keyword) {
  9.     
  10.     return (IACpushlistitem (IACglobals.event, val, keyword));
  11.  
  12.     } /*IACpushlistparam*/
  13.  
  14.  
  15. Boolean IACreturnlist (AEDescList *val) {
  16.     
  17.     return (IACpushlistitem (IACglobals.reply, val, keyDirectObject));
  18.  
  19.     } /*IACreturnlist*/
  20.  
  21.  
  22. Boolean IACgetlistparam (OSType keyword, AEDescList *val) {
  23.     
  24.     if (!IACgetlistitem (IACglobals.event, keyword, val)) {
  25.         
  26.         IACparamerror (IACglobals.errorcode, "\plist", keyword);
  27.         
  28.         return (false);
  29.         }
  30.     
  31.     IACglobals.nextparamoptional = false; /*must be reset for each param*/
  32.     
  33.     return (true);
  34.     } /*IACgetlistparam*/
  35.     
  36.  
  37. Boolean IACnewlist (AEDescList *list) {
  38.     
  39.     register OSErr ec;
  40.     
  41.     ec = AECreateList (NULL, (Size) 0, false, list);
  42.     
  43.     IACglobals.errorcode = ec;
  44.     
  45.     return (ec == noErr);
  46.     } /*IACnewlist*/
  47.  
  48.  
  49. Boolean IACgetlistitem (AEDescList *list, long n, AEDescList *val) {
  50.     
  51.     register OSErr ec;
  52.     DescType key;
  53.     Size actualSize;
  54.     
  55.     if ((*list).descriptorType != typeAEList) {
  56.     
  57.         ec = AEGetKeyDesc (list, n, typeAEList, val);
  58.         
  59.         if (ec != errAEDescNotFound)
  60.             goto done;
  61.         }
  62.  
  63.     ec = AEGetNthDesc (list, n, typeAEList, &key, val);
  64.  
  65.     done:
  66.     
  67.     IACglobals.errorcode = ec;
  68.     
  69.     return (ec == noErr);
  70.     } /*IACgetlistitem*/
  71.  
  72.  
  73. Boolean IACpushlistitem (AEDescList *list, AEDescList *x, long n) {
  74.     
  75.     register OSErr ec;
  76.     
  77.     if ((*list).descriptorType != typeAEList)
  78.         ec = AEPutKeyDesc (list, n, x);
  79.     else
  80.         ec = AEPutDesc (list, n, x);
  81.     
  82.     IACglobals.errorcode = ec;
  83.     
  84.     AEDisposeDesc (x);
  85.     
  86.     (*x).descriptorType = typeNull;
  87.     
  88.     (*x).dataHandle = NULL;
  89.     
  90.     return (ec == noErr);
  91.     } /*IACpushlistitem*/
  92.  
  93.